<%--
  Created by Cweili on 13-9-12.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java"  pageEncoding="utf-8"
         trimDirectiveWhitespaces="true" isELIgnored="false" %>
<%@ taglib prefix="t" tagdir="/WEB-INF/tags" %>
<t:html>
	<t:head />
	<t:body>
		<t:navbar />
		<t:panel>
			<div class="panel-heading">
				<h3>
					${title}
					<button class="btn btn-primary new" data-toggle="modal" data-target="#editorModal"><t:icon>plus</t:icon></button>
				</h3>
			</div>
			<t:datatable id="list">
				<th>使用者</th>
				<th>IP地址</th>
				<th>分组</th>
				<th>说明</th>
				<th>使用时间</th>
				<th width="66px"><t:icon>edit</t:icon></th>
			</t:datatable>
		</t:panel>
		<t:editor title="${title}">
			<t:formgroup name="name" label="IP地址">
				<input type="text" class="form-control" id="ip" name="ip" placeholder="必填">
			</t:formgroup>
			<t:formgroup name="ipGroup" label="分组">
				<input type="hidden" id="ipGroup" name="ipGroup">
			</t:formgroup>
			<t:formgroup name="comment" label="说明">
				<textarea class="form-control" id="comment" name="comment" placeholder="IP地址说明" rows="8"></textarea>
			</t:formgroup>
		</t:editor>
		<t:modal id="applyModal" title="IP申请">
			<div class="modal-body"></div>
		</t:modal>
		<t:modal id="loginModal" title="${c[APP_NAME]} 登录">
			<div class="modal-body">
				<form class="loginForm" role="form">
					<input type="text" class="form-control" name="account" placeholder="帐号(无账号请点击注册)" autofocus>
					<input type="password" class="form-control" name="password" placeholder="密码(可选)">
					<input type="hidden" name="salt">
					<div class="col-md-6">
						<button class="btn btn-lg btn-success btn-block" type="submit">
							<t:icon>signin</t:icon> 登录
						</button>
					</div>
					<div class="col-md-6">
						<button id="regBtn" class="btn btn-lg btn-info btn-block" type="button">
							<t:icon>book</t:icon> 注册
						</button>
					</div>
					&nbsp;<span class="loginMsg"></span>
				</form>
			</div>
		</t:modal>
		<t:modal id="regModal" title="${c[APP_NAME]} 注册">
			<form class="form-horizontal" role="form">
				<div class="modal-body">
					<t:formgroup name="account" label="帐号">
						<input type="text" class="form-control" name="account" placeholder="必填">
					</t:formgroup>
					<t:formgroup name="password" label="密码">
						<input type="password" class="form-control" name="password" placeholder="可选">
					</t:formgroup>
					<t:formgroup name="passwordRpt" label="密码">
						<input type="password" class="form-control" name="passwordRpt" placeholder="请再次输入">
					</t:formgroup>
					<t:formgroup name="name" label="姓名">
						<input type="text" class="form-control" name="name" placeholder="必填">
					</t:formgroup>
				</div>
				<div class="modal-footer">
					<div class="col-md-7 msg"></div>
					<div class="col-md-5">
						<button class="btn btn-lg btn-success" type="submit">
							<t:icon>book</t:icon> 注册
						</button>
						<button id="loginBtn" class="btn btn-lg btn-info" type="button">
							<t:icon>signin</t:icon> 登录
						</button>
					</div>
				</div>
			</form>
		</t:modal>
		<t:template id="applyAlertTpl">
			<div class="alert alert-'$type'">'$message'</div>
		</t:template>
		<t:template id="applyBtnTpl">
			<button type="button" class="btn btn-info btn-lg" onclick="apply('$id')">
				<t:icon>check</t:icon> 使用
			</button>
		</t:template>
		<t:template id="listTpl">
			<td>'$customerName'</td>
			<td><h4>'$ip'</h4></td>
			<td>'$ipGroupName'</td>
			<td>'$commentStr'</td>
			<td>'$startTimeStr'</td>
			<td>
				<button type="button" class="btn btn-primary btn-lg" onclick="edit('$id')"
				        data-toggle="modal" data-target="#editorModal">
					<t:icon>pencil</t:icon>
				</button>
			</td>
		</t:template>
		<t:template id="ipGroupBtnTpl">
			<button class="btn btn-default btn-'$id'" onclick="$('#ipGroup').val('$id')">'$name'</button>
		</t:template>
	</t:body>
</t:html>
